<!--name：管理员 -->
<!--user：sa0 -->
<!--date：2021/3/11 14:34 -->
<?include file='Admin/components/header.html'?>
<div>
    <el-card>
        <a class="layui-btn">普通管理员</a>
        <a href="<?ap path='/Account/Admin/1'?>" class="layui-btn layui-btn-primary">超级管理员</a>
    </el-card>
    <el-card class="mt-3">
        <el-table :data="admin_list"
                  style="width: 100%">
            <el-table-column label="昵称">
                <template #default="scope">
                    <div style="line-height: 40px;display: flex;">
                        <el-image style="width: 40px; height: 40px" class="rounded"
                                  :src="`<?$avatar_path?>${scope.row.avatar}`"></el-image>
                        <span class="ml-2">{{ scope.row.username }}</span>
                    </div>
                </template>
            </el-table-column>
            <el-table-column label="登录时间" width="180">
                <template #default="scope">
                    <span>{{ scope.row.update_time }}</span>
                </template>
            </el-table-column>
            <el-table-column label="状态" width="180">
                <template #default="scope">
                    <el-tag size="small"
                            :type="scope.row.status==1?'success':'danger'"
                            effect="dark">
                        <span>{{ scope.row.status==1?'正常':'停用' }}</span>
                    </el-tag>
                </template>
            </el-table-column>
            <el-table-column label="操作" width="180">
                <template #default="scope">
                    <a class="layui-btn layui-btn-sm">重置密码</a>
                    <a class="layui-btn layui-btn-sm layui-btn-danger">{{ scope.row.status==1?'停用账号':'开启账号' }}</a>
                </template>
            </el-table-column>
        </el-table>

        <el-pagination
                class="mt-3"
                @current-change="currentPage"
                background="#009688"
                :page-size="<?$size?>"
                :current-page="<?$page?>"
                layout="prev, pager, next"
                :total="list_count">
        </el-pagination>
    </el-card>
</div>
<?include file='Admin/components/body.html'?>
<?include file='Admin/components/script.html'?>
<script>
    const App = {
        data() {
            return {
                admin_list: [],
                list_count: 0,
            };
        },
        methods: {
            currentPage(e) {
                if (Number('<?$page?>') !== e) sa0.jump(`<?ap path='/Account/Admin'?>/<?$type?>/${e}`);
            },
            getAdminList() {
                sa0.post({
                    url: "<?ap path='/ajax/Account/Admin/List'?>",
                    data: {
                        page: '<?$page?>',
                        type: '<?$type?>',
                        size: '<?$size?>',
                    },
                    then: (res) => {
                        this.admin_list = res.data.list;
                        this.list_count = res.data.count;
                    },
                    error: () => {
                    },
                });
            },
        },
        mounted() {
            this.getAdminList();
        },
    };
</script>
<?include file='Admin/components/footer.html'?>